package com.shigen.demo.util;

import com.alibaba.fastjson.JSONObject;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletResponse;

public class ResponseUtil {

  public static void responseOut(HttpServletResponse response, Object result) throws IOException {
    response.setCharacterEncoding("UTF-8");
    response.setContentType("application/json; charset=utf-8");
    PrintWriter out = null;
    String json = JSONObject.toJSON(result).toString();
    out = response.getWriter();
    out.append(json);
    out.flush();
  }
}
